import { SaaSTenantPageParams, SaaSTenantListItem, SaaSDelTenantParams } from './model/tenantModel';
import { tenantHttp } from '/@/utils/http/axios';

enum Api {
  SaaSTenantList = '/tenant/getTenantList',
  SaaSTenantDelete = '/tenant/deleteTenant',
}

export const getSaaSTenantList = (params: SaaSTenantPageParams) => {
  // 企业列表查询请求参数
  const res = tenantHttp.get<SaaSTenantListItem[]>({
    url: Api.SaaSTenantList,
    params,
  });
  return res;
};

export const deleteSaaSTenant = (params: SaaSDelTenantParams) => {
  // 删除企业的ID
  return tenantHttp.get<string>({ url: Api.SaaSTenantDelete, params });
};

export const getTenantLogoAndName = (domainName: string) => {
  // 根据域名获取租户的logo及名称
  return tenantHttp.get<{ tenantLogo: string; tenantName: string }>({ url: `/tenants/logo/${domainName}` });
};
